Page({

	bindFormSubmit: function (e) {
		console.log(e.detail.value.textarea)
		if (e.detail.value.textarea.length == 0 ) {
			wx.showModal({
				title: '提示',
				content: '意见反馈不能为空！',
				showCancel: false,
				success: function (res) {
					if (res.confirm) {
						console.log('用户点击确定')
					}
				}
			})
		} else {
			wx.request({
        url: app.globalData.serverAddress + '/advice/apis/addAdvice',
				data: {
					advice: { advice_content: e.detail.value.textarea }
				},
				method: 'POST',
				success: function (res) {
					console.log(res);
					wx.showModal({
						title: '提示',
						content: '提交成功！',
						showCancel: false,
						success: function (res) {
							if (res.confirm) {
								wx.navigateBack();
							}
						}
					})
				},
				fail: function (res) {
					wx.showToast({
						title: '提交失败',
						icon: 'fail',
						duration: 2000
					})
				},
				complete: function (res) {
					console.log('submit complete');
				}

			})
		}    
	
	}
})